package com.sapdroid.sapdroiddo.content;

import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

public class ItemTable {
	
	// Database table
	public static final String TABLE_ITEM = "item";

	// Table columns
	public static final String COLUMN_ID = "_id";
	public static final String COLUMN_LISTID = "list_id";
	public static final String COLUMN_DESCRIPTION = "description";
	public static final String COLUMN_STATUS = "status";

	
	//Possible state values
	public static final int OPEN = 0;
	public static final int DONE = 1;
	

	// Database creation SQL statement
	private static final String DATABASE_CREATE = "create table " + TABLE_ITEM + "(" + COLUMN_ID + " integer primary key autoincrement, " + COLUMN_LISTID + " text not null, " + COLUMN_DESCRIPTION + " text not null, " + COLUMN_STATUS + " int);";

	public static void onCreate(SQLiteDatabase database) {
		database.execSQL(DATABASE_CREATE);
	}

	public static void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) {
		Log.w(ItemTable.class.getName(), "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data");
		database.execSQL("DROP TABLE IF EXISTS " + TABLE_ITEM);
		onCreate(database);
	}
}